<?php
/**
 * Created by PhpStorm.
 * User: zl
 * Date: 2017/5/10
 * Time: 7:47
 * 描述：获取部门用户的PHP文件
 *
 */
    require_once('../Common.php');
    require_once('../SQLBase.php');

    $conn = new SQLBase();

    $sectionID = $_REQUEST['sectionID'];

    $query = 'SELECT user.user_ID, user.user_name FROM user INNER JOIN section WHERE user.user_ID = section.user_ID AND section.section_ID='."'$sectionID'";


    $result = $conn->queryData($query);


    $resultArray = Array();

    if($result->num_rows == 0){
        $resultArray['state'] = 0;
    }
    else{
        $resultArray['state'] = 1;
        $resultArray['data'] = array();
        for($i = 0; $i < $result->num_rows; $i++){
            $data = $result->fetch_array();
            $resultArray['data'][$i] = Array('user_id'=>$data['user_ID'], 'user_name'=>$data['user_name']);
        }
    }


    echo json_encode($resultArray);

?>
